***************************************
****  Table A4: Correlation between financial worries and happiness
***************************************
	
use "$dir/Data/analysis_main.dta", clear


* reverse scale, so that it follows same pattern as happiness scale
* (higher numbers mean less worried)
gen future_fin_worry2 = 1 if future_fin_worry == 4
replace future_fin_worry2 = 2 if future_fin_worry == 3
replace future_fin_worry2 = 3 if future_fin_worry == 2
replace future_fin_worry2 = 4 if future_fin_worry == 1

label var future_fin_worry2 "Worries scale"
label var worry1_m "Very worried or worried"
label var worry2_m "Very worried" 


**** Regressions - just make table with the following 3 simple regressions: 
eststo clear
eststo: reg happiness_scale future_fin_worry2 if pid1==1 & cash==0 , vce(robust)
	qui summarize happiness_scale if e(sample)==1 
	qui estadd scalar cont = r(mean)
eststo: reg happy1 worry1_m if pid1==1 & cash==0 , vce(robust)
	qui summarize happy1 if e(sample)==1 
	qui estadd scalar cont = r(mean)
eststo: reg happy2 worry2_m if pid1==1 & cash==0 , vce(robust)
	qui summarize happy2 if e(sample)==1 
	qui estadd scalar cont = r(mean)

	
#delimit ;
local tablerow future_fin_worry2 worry1_m worry2_m;

esttab using "$oa/$t/Table_A4.tex", 
    b(3) se booktabs star(* .1 ** .05 *** .01) nonotes nomtitles
    replace label style(tex) gaps keep(`tablerow') order(`tablerow') 
    stats(cont N, labels("Dependent variable mean" "N: workers") fmt(%9.2fc %9.0fc))    
	prehead("{\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} 
	\begin{tabular}     
	{@{\extracolsep{4pt}}l*{10}{>{\centering\arraybackslash}m{3.5cm}}@{}}      \toprule    
	&Happiness scale & Very happy or happy & Very happy    \\
	") ;
		
#delimit cr		
